package boddaert.philippe.cashGame.net;

import java.util.HashMap;

public class WebPageGetterFactory {

	private static HashMap<Net, WebPageGetter> parsers = new HashMap<Net, WebPageGetter>();

	public static WebPageGetter get(Net net) {
		if (net == null)
			throw new IllegalArgumentException();

		if (parsers.containsKey(net))
			return parsers.get(net);
		else {
			WebPageGetter webPageGetter = null;

			if (Net.WEB.equals(net))
				webPageGetter = new WWWWebPageGetter();
			else if (Net.FILE_SYSTEM.equals(net))
				webPageGetter = new SystemFileWebPageGetter();

			parsers.put(net, webPageGetter);

			return webPageGetter;
		}

	}
}
